#ifndef _ASTAR_NODE_H_
#define _ASTAR_NODE_H_
#include <map>
#include "types.h"

class Node;
typedef std::map<NodeIndex, Node*> NodeMap;

class Node
{
public:
  Node(const NodeIndex& index);
  ~Node(void);

  const NodeIndex& getIndex(void) const;
  void addNeighbor(Node* node);
  void removeNeighbor(Node* node);
  void clearNeighbors(void);
  NodeMap& getNeighbors(void);
  Node* getFromNode(void) const;
  void updateFromNode(Node* node);
  float computeG(Node* neighbor) const;
  float computeH(Node* goal) const;
  float updateF(void);

public:
  float h;    // Heuristic Value - estimated cost from this node to goal
  float g;    // Total cost value from start to this node
  float f;    // Estimated total cost from start to goal through this node
  
private:
  const NodeIndex mcIndex;	
  NodeMap mNeighbors;
  Node* mpFrom;
};

#endif // _ASTAR_NODE_H_
